<template>
	<view class="page">
		<view class="message_item" v-for="(item,index) in messageList" :key="item.title"
			@click="clickFun(path[index].url)">
			<image :src="getImageUrl(item.img)"></image>
			<view class="message_title">{{item.title}}</view>
		</view>
	</view>
</template>

<script>
	import {
		getHeaderList
	} from '@/api/home'
	export default {
		data() {
			return {
				messageList: [{
						title: "服务提醒",
						img: "http://up.kukudesk.com/pic_360/03/35/d2/0335d2d394163ed7b25b80729d480379.jpg"
					},
					{
						title: "时间币助手",
						img: "http://up.kukudesk.com/pic_360/85/c6/11/85c61135f7bf7f350c63d9704f00cf03.jpg"
					},
					{
						title: "审核通知",
						img: "http://up.kukudesk.com/pic_360/a7/5b/e6/a75be6596d355da615c4bba77f944460.jpg"
					},
					{
						title: "系统消息",
						img: "http://up.kukudesk.com/pic_360/a7/5b/e6/a75be6596d355da615c4bba77f944460.jpg"
					}
				],
				path: [
					{url: '/pages/message/message-list/message-list'},
					{url: '/pages/message/message-list/message-list'},
					{url: '/pages/message/message-list/message-list'},
					{url: '/pages/message/message-list/message-list'}
				]
			}
		},
		mounted() {
			this.getMessageIcon()
		},
		methods: {
			getMessageIcon() {
				let token = uni.getStorageSync('token');
				getHeaderList({
					'token': token,
					'typeName': 'newslist'
				}).then(res => {
					console.log("图标：", res);
					this.messageList = res.data;
				})
			},
			getImageUrl(src) {
				return this.domain + src;
			},
			clickFun(url) {
				console.log("点击了", url);
				// uni.navigateTo({
				// 	url: url
				// })
				wx.navigateTo({
				    url: url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		height: 100%;
		width: 100vw;
		min-height: 93vh;
		background-color: $global_bg_color;
	}

	.message_item {
		margin: 0 8rpx;
		height: 150rpx;
		display: flex;
		margin-top: 2rpx;
		align-items: center;
		background-color: #FFFFFF;
		border-radius: 8rpx;

		image {
			height: 100rpx;
			width: 100rpx;
			border-radius: 50rpx;
			margin: 0rpx 10rpx;
		}

		;

		.message_title {
			margin-left: 15rpx;
			font-size: 35rpx;
		}
	}
</style>
